﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo
{
    class SumUtils
    {
        //计算两个整数相加、
        //两个小数相加、 
        //两个字符串相加、
        //以及从 1 到指定整数的和的方法。
        public void sum(int num, int num2)
        {
            Console.WriteLine("两个整数相加：{0}", (num + num2));
            Console.ReadKey();
        }

        public void  sum(double num, double num2)
        {
            Console.WriteLine("两个小数相加：{0}", (num + num2));
            Console.ReadKey();
        }
        public void sum(String num, String num2)
        {
            Console.WriteLine("两个字符串相加：{0}", (num + num2));
            Console.ReadKey();
        }
        public void sum(int num)
        {
            int sum = 0;
            for (int i = 1; i <= num ; i++)
            {
                sum += i;
            }
            Console.WriteLine("1到{0}的和:{1}", num, sum);
            Console.ReadKey();
        }
    }
}

